<@override name="title"><#if dish['id']?? && dish['id'] gt 0>编辑<#else>新建</#if>菜品</@override>

<@override name="styles">
<link href='${ctx}/static/plugins/validation/validationEngine.jquery.css' rel='stylesheet' type='text/css'>
<link href='${ctx}/static/plugins/ztree/css/metroStyle/metroStyle.css' rel='stylesheet' type='text/css'>
<!--引入CSS-->
<link rel="stylesheet" type="text/css" href="${ctx}/static/plugins/webuploader/webuploader.css">
<!-- Theme style -->
<link href="${ctx}/static/plugins/iCheck/all.css" rel="stylesheet" type="text/css" />
</@override>


<@override name="header">
<h4>
    <ol class="breadcrumb">
        <li><a href="#"><i class="fa fa-map-marker"></i>&nbsp;&nbsp; 菜品管理</a></li>
        <li><a href="${ctx}/dishes/dish">菜品信息</a></li>
        <li><a href="#"><#if dish['id']?? && dish['id'] gt 0>编辑<#else>新建</#if>菜品</a></li>
    </ol>
</h4>
</@override>

<@override name="content">
<div class="row">
    <div class="col-xs-12">
        <form class="form-horizontal" action="${ctx}/dishes/dish/save" method="post" role="form" id="data-form">
            <input type="hidden" value="${dish.id!}" name="dish.id" id="dishId">

            <div class="panel panel-default">
                <div class="panel-heading"><h6 class="panel-title">菜品信息</h6></div>
                <div class="panel-body">
                    <#if message??>
                        <div class="alert alert-danger fade in widget-inner">
                            <button type="button" class="close" data-dismiss="alert">×</button>
                        ${message!}
                        </div>
                    </#if>

                    <div class="form-group">
                        <label class="col-sm-2 control-label text-right">封面:</label>
                        <div class="col-sm-9" id="dish-cover-ctx" data-render="${dish.cover!}"></div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-2 control-label text-right">菜品分类:</label>
                        <div class="col-sm-9">
                            <select data-placeholder="请选择菜品分类..." class="form-control validate[required]" name="dish.category_id">
                                <#list categories as item>
                                    <option value="${item.id!}" <#if dish.category_id?? && dish.category_id == item.id>selected</#if>>${item.name!}</option>
                                </#list>
                            </select>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-2 control-label text-right">名称:</label>
                        <div class="col-sm-9">
                            <input type="text" class="form-control validate[required]" name="dish.name" value="${dish.name!}">
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-2 control-label text-right radio-checkbox-label">是否热门:</label>
                        <div class="col-sm-9">
                            <#if dish.is_hot?? && dish.is_hot == 1>
                                <label>
                                    <input type="radio" name="dish.is_hot" class="minimal" value="1" checked> 是
                                </label>
                                <label>
                                    <input type="radio" name="dish.is_hot" class="minimal" value="0"> 否
                                </label>
                            <#else>
                                <label>
                                    <input type="radio" name="dish.is_hot" class="minimal" value="1"> 是
                                </label>
                                <label>
                                    <input type="radio" name="dish.is_hot" class="minimal" value="0" checked> 否
                                </label>
                            </#if>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-2 control-label text-right">价格:</label>
                        <div class="col-sm-9">
                            <input type="text" class="form-control validate[required, custom[number]]" name="dish.price" value="${dish.price!}">
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-2 control-label text-right">排序:</label>
                        <div class="col-sm-9">
                            <input type="text" class="form-control validate[required, custom[integer]]" name="dish.seq" value="${dish.seq!}">
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-2 control-label text-right radio-checkbox-label">标签:</label>
                        <div class="col-sm-9">
                            <#if tags?? && tags?size gt 0>
                                <#list tags as item>
                                    <label>
                                        <input type="checkbox" name="dish_tags" class="minimal" value="${item.id!}" <#if item.dish??>checked</#if>> ${item.name!} &nbsp;
                                    </label>
                                </#list>
                            </#if>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-2 control-label text-right radio-checkbox-label">状态:</label>
                        <div class="col-sm-9">
                            <#if dish.status?? && dish.status == 1>
                                <label>
                                    <input type="radio" name="dish.status" class="minimal" value="1" checked> 在售
                                </label>
                                <label>
                                    <input type="radio" name="dish.status" class="minimal" value="0"> 停售
                                </label>
                            <#else>
                                <label>
                                    <input type="radio" name="dish.status" class="minimal" value="1"> 在售
                                </label>
                                <label>
                                    <input type="radio" name="dish.status" class="minimal" value="0" checked> 停售
                                </label>
                            </#if>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-2 control-label text-right">图片:</label>
                        <div class="col-sm-9" id="dish-pictures-ctx" data-render="${dish.pictures!}"></div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-2 control-label text-right">备注:</label>
                        <div class="col-sm-9">
                            <script id="container" name="dish.remark" type="text/plain">
                                ${dish.remark!}
                            </script>
                        </div>
                    </div>

                    <div class="form-actions text-center">
                        <input type="submit" id="submit" value="提交" class="btn btn-primary">
                    </div>

                </div>
            </div>
        </form>
    </div><!-- /.col -->
</div><!-- /.row -->
</@override>

<@override name="scripts">
<script type="text/javascript" src="${ctx}/static/plugins/ztree/jquery.ztree.all-3.5.js"></script>
<script type="text/javascript" src="${ctx}/static/plugins/ztree/ztree.js"></script>

<script type="text/javascript" src="${ctx}/static/plugins/validation/jquery.validationEngine.js"></script>
<script type="text/javascript" src="${ctx}/static/plugins/validation/jquery.validationEngine-zh_CN.js"></script>

<!--引入JS-->
<script type="text/javascript" src="${ctx}/static/plugins/webuploader/webuploader.js"></script>

<!-- iCheck 1.0.1 -->
<script src="${ctx}/static/plugins/iCheck/icheck.min.js"></script>

<script src="${ctx}/static/plugins/ueditor/ueditor.config.js"></script>
<script src="${ctx}/static/plugins/ueditor/ueditor.all.js"></script>

<script type="text/javascript" src="${ctx}/static/views/dishes/dish/item.js"></script>
</@override>

<@extends name="/WEB-INF/_basic/main.ftl"/>